<title>举报设置</title>
  
<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">主页</a>
    <a><cite>问答管理</cite></a>
    <a><cite>举报设置</cite></a>
  </div>
</div>

  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">

  <!--选项卡-->
      <div class="layui-card-body">
          <div class="layui-tab layui-tab-brief" lay-filter="">
            <ul class="layui-tab-title">
              <li class="layui-this"><a lay-href="wendasns/report/index">举报原因</a></li>
              <li><a lay-href="wendasns/report/log">举报日志</a></li>
            </ul>
          </div>
      </div>
      
          <div class="layui-card-body">
        <div style="padding-bottom: 10px;">
        	<a href="javascript:;" class="layui-btn J_add"><i class="layui-icon layui-icon-add-circle"></i>添加</a>
        	<a href="wendasns/report/remove" class="layui-btn J_req" title="确定移除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
        </div>
            <table id="J_table_list" lay-filter="J_table_list" url="{:url('wendasns/report/edit')}"></table>
          </div>
          
        </div>
      </div>
    </div>
  </div>
<script type="text/html" id="J_table_tool">
	<a href="wendasns/report/remove" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="req" title="确定删除吗？"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>

<script>
;!function(){
    var $ = layui.$
    ,admin = layui.admin
    ,form = layui.form
    ,table = layui.table
    ,layer = layui.layer;
    
    table.render({
      elem: '#J_table_list'
      ,url: '{:url('wendasns/report/list')}'
      ,cols: [[
        {type:'checkbox'}
        ,{field:'id', title:'ID', width:80,align:'center'}
        ,{field:'reason', title:'举报原因', minWidth:120, edit: 'text'}
        ,{title:'操作',width:100,align:'center',toolbar:'#J_table_tool'}
      ]]
  ,page: true
    ,limit: 20
    ,height: 'auto'
     ,text: {
     	none: '暂无数据'
     }
    })
//添加举报原因
$('.J_add').on('click', function(){
        layer.prompt({title: '举报原因', formType: 3}, function(reason, index){
              $.ajax({
			      url: '{:url('wendasns/report/add')}'
			      ,type: 'post'
			      ,data: {reason:reason}
			      ,dataType: 'json'
			      ,complete: function(XMLHttpRequest, textStatus){
			      	  layer.close(index);
			      }
			      ,success: function(res){
			          table.reload('J_table_list');
			          layer.msg(res.msg);
			      }
			      ,error:function(res){
			          layer.msg('提交异常');
			      }
    		});
          
        });
});



}();
</script>